import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/login.vue'
import UserRegister from '@/views/register/userRegister'
import UnitRegister from '@/views/register/unitRegister'
import Layout from '../views/Text.vue'


// 子路由
import UnitList from '@/views/unit/unitList'
import UnitReviewed from '@/views/unit/unitReviewed'

import Achieve from '@/views/Achievement/achieve'
import AchieveList from '@/views/Achievement/achievementList'
// Notice
import Consultation from '@/views/Notice/consultation'
import Members from '@/views/Notice/Members'
import Notice from '@/views/Notice/notice'
import Publicity from '@/views/Notice/Publicity'
import Statute from '@/views/Notice/statute'
import Activity from '@/views/activity/activity'
import ActivityList from '@/views/activity/activityList'

import User from '@/views/user/user'

import ActivityApply from '@/views/ActivityApply/activityApply.vue'
import ActivityApplyList from '@/views/ActivityApply/activityApplyList.vue'
import News from '@/views/News/news'

import Newsx from '@/views/News/newsx'
Vue.use(VueRouter)

const routes = [
  {path:'/',name:'Login',component:Login},//登录
  {path:'/userRegister',name:'UserRegister',component:UserRegister},//注册
  {path:'/unitRegister',name:'UnitRegister',component:UnitRegister},//注册
  {path:'/layout',name:'Layout',component:Layout,children:[
    {path:'/unitList',name:'UnitList',component:UnitList},//机构列表
    {path:'/unitReviewed',name:'UnitReviewed',component:UnitReviewed},//机构列表
    {path:'/achieve',name:'Achieve',component:Achieve},//成果列表
    {path:'/achieveList',name:'UnitReAchieveListviewed',component:AchieveList},//成果待审核
    // 信息
    {path:'/consultation',name:'Consultation',component:Consultation},
    {path:'/members',name:'Members',component:Members},

    {path:'/notice',name:'Notice',component:Notice},
    {path:'/publicity',name:'Publicity',component:Publicity},

    {path:'/statute',name:'Statute',component:Statute},

    {path:'/activity',name:'Activity',component:Activity},//活动
    {path:'/activityList',name:'ActivityList',component:ActivityList},//活动

    {path:'/user',name:'User',component:User},//用户
    // 活动报名

    {path:'/activityApply',name:'ActivityApply',component:ActivityApply},//活动报名
    {path:'/activityApplyList',name:'ActivityApplyList',component:ActivityApplyList},//用户
    {path:'/news',name:'News',component:News},//学会简章
    {path:'/newsx',name:'Newsx',component:Newsx},//用户

  ]},//
]
const VueRouterPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (to){
  return VueRouterPush.call(this,to).catch(err => err)
}


const router = new VueRouter({
  routes
})

export default router
